package cn.hy.preparelesson.common.enums;

/**
 * 学校微信使用方式配置（公众号，企业微信）
 */
public enum WechatType {
    //
    CORP((byte) 0, "微信企业号"),
    GZH((byte) 1, "微信公众号"),;

    private byte code;
    private String msg;

    WechatType(byte code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public byte getCode() {
        return code;
    }

    public void setCode(byte code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 根据code获取
     * @return
     */
    public static WechatType getByCode(Byte code) {
        if (code == null) {
            return null;
        }
        for (WechatType value : WechatType.values()) {
            if (value.getCode() == code) {
                return value;
            }
        }

        return null;
    }

}
